package com.jinlejia.erp.ui.mine.sign;

import android.app.AlertDialog;
import android.content.Context;
import android.graphics.drawable.ColorDrawable;
import android.os.Bundle;
import android.view.Gravity;
import android.view.View;
import android.view.Window;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.jinlejia.erp.R;

/**
 * Created by Administrator on 2018/12/20 0020.
 * 外出说明
 */

public class DialogOutReason extends AlertDialog {
    private Context mContext;
    private String str;

    public DialogOutReason(Context context, String c) {
        super(context);
        this.str = c;
    }


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        this.setCanceledOnTouchOutside(false);
        Window window = this.getWindow();
        // *** 主要就是在这里实现这种效果的.
        // 设置窗口的内容页面,shrew_exit_dialog.xml文件中定义view内容
        window.setContentView(R.layout.dialog_out_reason);
        window.setGravity(Gravity.CENTER);
        window.setLayout(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
        window.setBackgroundDrawable(new ColorDrawable());
        setCanceledOnTouchOutside(true);

        ((TextView) window.findViewById(R.id.content)).setText(str);

        window.findViewById(R.id.close).setOnClickListener(v -> dismiss());

    }
}
